1. Field of the Invention
The present invention relates to code generation and, more specifically, to generating code from a graphical program.
2. Background Information
Engineers and scientists often use computer-based, high-level development tools or environments to perform algorithm development, data visualization, simulation, and model design, among other tasks. Exemplary high-level development tools include the MATLAB® and Simulink® technical computing environments from The MathWorks, Inc. of Natick, Mass. With the Simulink® technical computing environment, a user creates a graphical model by dragging and dropping blocks from a library browser onto a graphical editor, and connecting them with lines that establish mathematical relationships and/or signals among the blocks. Stateflow® modeling environment is an extension to the Simulink® technical computing environment that allows users to specify state machines and flow charts. A Stateflow chart may be created by dragging states, junctions and functions from a graphical palette into a drawing window. The user can then create transitions and flow by connecting states and junctions together.
Other add-on products or tools exist for generating code from Simulink models, MATLAB files and/or functions, often referred to as M-files, and/or Stateflow charts. Specifically, the Real-Time Workshop® add-on product, also available from The MathWorks, Inc., generates C or C++ code from Simulink models to create standalone implementations of models that operate in real-time and non-real-time in a variety of target environments, such as personal computers (PCs), workstations, Digital Signal Processors (DSPs), microcontrollers, etc. The Simulink Hardware Description Language (HDL) Coder™ add-on product from The MathWorks, Inc. generates HDL code based on Simulink models or Stateflow charts. The generated HDL code can be exported to synthesis and layout tools for hardware realization, such as Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Complex Programmable Logic Devices (CPLDs), etc.
Furthermore, the xPC Target add-on product from The MathWorks, Inc. supports the prototyping, testing and deployment of real-time systems. More specifically, with the xPC Target add-on product, a user may deploy C or C++ code generated from a Simulink model to a target PC running a real-time kernel.